package com.code.leetcode.before50;

import java.util.Arrays;

/**
 * @author codeDorado
 * @version 1.0
 * @date 2020/7/24 10:19
 */
public class The75 {
    public void sortColors(int[] nums) {
        int left = 0, right = nums.length - 1;
        int curr = 0;
        int temp;
        while (curr <= right) {
            if (nums[curr] == 0) {
                temp = nums[curr];
                nums[curr++] = nums[left];
                nums[left++] = temp;
            } else if (nums[curr] == 2) {
                temp = nums[curr];
                nums[curr] = nums[right];
                nums[right--] = temp;
            } else {
                curr++;
            }
        }
    }
}
